﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DBUtil.Extensions
{
    /// <summary>
    /// 字符串扩展
    /// </summary>
    public static class SrtringExtensions
    {
        /// <summary>
        /// 包裹字符串并防注入
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string WrapToSql(this string str)
        {
            if (str == null) return str;
            return $"'{str.Replace("'", "''")}'";
        }
    }
}
